package ude.univ.esiag.gon.uchiha.gui;

import javax.swing.JFrame;

import ude.univ.esiag.gon.uchiha.core.DCSClient;

public class MyFrame extends JFrame{
	private static final long serialVersionUID = 1L;
	
	private DCSClient client;
	public MyFrame() {
		this.setTitle("Client");
		this.setSize(600, 400);
		this.setDefaultCloseOperation(EXIT_ON_CLOSE);
		this.setAlwaysOnTop(true);
		this.setVisible(true);
		client = DCSClient.getInstance();
		client.init("fr");
	//	client.createTopic("yahoo");
		new Thread(new Runnable() {
			
			public void run() {
				client.write("ibou");
			}
		}).start();
		new Thread(new Runnable() {
			
			public void run() {
				client.write("hello");
			}
		}).start();
		new Thread(new Runnable() {
			
			public void run() {
				client.write("fidele");
			}
		}).start();
		new Thread(new Runnable() {
			
			public void run() {
				Object obj = client.read();
				System.out.println("1 " + obj);
			}
		}).start();
		new Thread(new Runnable() {
			
			public void run() {
				Object obj = client.read();
				System.out.println("2 " + obj);
			}
		}).start();
		new Thread(new Runnable() {
			
			public void run() {
				Object obj = client.read();
				System.out.println("3 " + obj);
			}
		}).start();
	}
	public static void main(String[] args) {
		new MyFrame();
	}
}
